﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SIS.Business
{
	/// <summary>
	/// Author: hieunv
	/// </summary>
	class Student
	{
		private string _id;
		private string _name;
		private string _departmentName;
		private int _totalCredits;
		/// <summary>
		/// 
		/// </summary>
		public string Id
		{
			get
			{
				return this._id;
			}
			set
			{
				try
				{
					this._id = value;
					if (this._id == "") throw new Exception("Id is empty!");
				}
				catch (Exception exc)
				{
					System.Windows.Forms.MessageBox.Show(exc.Message);
				}
				
			}
		}

		public string Name
		{
			get
			{
				return this._name;
			}
			set
			{
				try
				{
					this._name = value;
					if (this._name == "") throw new Exception("Name is empty!");
				}
				catch (System.Exception exc)
				{
					System.Windows.Forms.MessageBox.Show(exc.Message);
				}
				
			}
		}

		public string DepartmentName
		{
			get
			{
				return this._departmentName;
			}
			set
			{
				try
				{
					this._departmentName = value;
					if (this._departmentName == "") throw new Exception("Department name is empty!");
				}
				catch (System.Exception exc)
				{
					System.Windows.Forms.MessageBox.Show(exc.Message);
				}
			}
		}

		public int TotalCredits
		{
			get
			{
				return this._totalCredits;
			}
			set
			{
				try
				{
					this._totalCredits = value;
					if (this._totalCredits < 0) throw new Exception("Total creadits is non-negative!");
				}
				catch (System.Exception exc)
				{
					System.Windows.Forms.MessageBox.Show(exc.Message);
				}
			}
		}

		public Student() { }

		public Student(string _id, string _name, string _departmentName, int totalCredits)
		{
			this.Id = _id;
			this.Name = _name;
			this.DepartmentName = _departmentName;
			this.TotalCredits = _totalCredits;
		}
	}
}
